<html>

<head>
<title>Classes: AnimSaverHandler</title>
<style type="text/css"><!--tt { font-size: 10pt } pre { font-size: 10pt }--></style>
</head>

<body bgcolor="#ffffff" text="#000000" link="#000080" vlink="#800000" alink="#0000ff">

<table border="0" cellpadding="0" cellspacing="0" bgcolor="#d0d0d0">
  <tr>
    <td width="120" align="left"><a href="animload.html"><img width="96" height="20"
    border="0" src="../images/navlt.gif" alt="AnimLoaderHandler"></a></td>
    <td width="96" align="left"><a href="channel.html"><img width="64" height="20" border="0"
    src="../images/navrt.gif" alt="ChannelHandler"></a></td>
    <td width="96" align="left"><a href="../classes.html"><img width="56" height="20"
    border="0" src="../images/navup.gif" alt="Classes"></a></td>
    <td width="288" align="right"><a href="../index.html"><img width="230" height="20"
    border="0" src="../images/proglw.gif" alt="Table of Contents"></a></td>
  </tr>
</table>

<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td width="600"><br>
    <h3>AnimSaverHandler<br>
    AnimSaverInterface</h3>
    <p><small><strong>Availability</strong>&nbsp; LightWave 6.0</small><br>
    <small><strong>Component</strong>&nbsp; Layout</small><br>
    <small><strong>Header</strong>&nbsp; <a href="../../include/lwanimsav.h">lwanimsav.h</a></small></p>
    <p>Animation savers write out a sequence of rendered images as an animation file. Anim
    savers add frames to the animation file as each frame is rendered. The rendered image is
    passed to the saver in the same way it's passed to <a href="framebuf.html">frame buffer
    display</a> plug-ins, except that animation savers are given a filename, and there is no
    pause after each frame.</p>
    <p><strong>Handler Activation Function</strong></p>
    <pre>   XCALL_( int ) MyAnimSaver( long version, GlobalFunc *global,
      LWAnimSaverHandler *local, void *serverData );</pre>
    <p>The <tt>local</tt> argument to an anim saver's activation function is an
    LWAnimSaverHandler.</p>
    <pre>   typedef struct st_LWAnimSaverHandler {
      LWInstanceFuncs *<strong>inst</strong>;
      LWItemFuncs     *<strong>item</strong>;
      int              <strong>type</strong>;
      LWError         (*<strong>open</strong>)  (LWInstance, int w, int h,
                                  const char *filename);
      void            (*<strong>close</strong>) (LWInstance);
      LWError         (*<strong>begin</strong>) (LWInstance);
      LWError         (*<strong>write</strong>) (LWInstance, const void *R, const void *G,
                                  const void *B, const void *alpha);
   } LWAnimSaverHandler;</pre>
    <p>The first two member of this structure point to the standard <a href="../handler.html">handler
    functions</a>. In addition to these, an anim loader also provides functions for opening
    and closing the file and for writing a frame, and it specifies what type of data it wants
    to receive. The <tt>context</tt> argument to the <tt>inst-&gt;create</tt> function is
    currently unused.<dl>
      <dt><strong><tt>type</tt></strong></dt>
      <dd>The type of pixel data Layout should send to the <tt>write</tt> function. This can be
        either <tt>LWAST_UBYTE</tt> or <tt>LWAST_FLOAT</tt>.</dd>
      <dt><tt><br>
        error = <strong>open</strong>( instance, width, height, filename )</tt></dt>
      <dd>Open the file. This function receives the width and height of the frame in pixels, and
        the name of the file. Called when a rendering session begins. Returns an error message
        string if an error occurs, otherwise it returns NULL.</dd>
      <dt><tt><br>
        <strong>close</strong>( instance )</tt></dt>
      <dd>Close the file. This is called when rendering is complete.</dd>
      <dt><tt><br>
        error = <strong>begin</strong>( instance )</tt></dt>
      <dd>Prepare to receive the next frame. Returns an error message string if an error occurs,
        otherwise it returns NULL.</dd>
      <dt><tt><br>
        error = <strong>write</strong>( instance, R, G, B, alpha )</tt></dt>
      <dd>Write the next scanline of the current frame. The scanlines for each frame are sent in
        order from top to bottom. The buffer arguments point to arrays of color channel values.
        There are exactly <tt>width</tt> values for each channel, one for each pixel in a
        scanline, and the values are either unsigned bytes or floats, depending on the <tt>type</tt>
        code. Returns an error message string or NULL.</dd>
    </dl>
    <p>You'll need a way to know when you can write each frame. You can initialize a scanline
    index to 0 in your <tt>begin</tt> and then increment it in <tt>write</tt> until you've
    received the last scanline. Or you can save the last completed frame in <tt>begin</tt>
    (save frame 1 when <tt>begin</tt> is called for frame 2, and so on) and save the last
    frame in <tt>close</tt>.</p>
    <p><strong>Interface Activation Function</strong></p>
    <pre>   XCALL_( int ) MyInterface( long version, GlobalFunc *global,
      LWInterface *local, void *serverData );</pre>
    <p>This is the standard <a href="../handler.html#ui">interface activation</a> for
    handlers. The saver's interface is invoked by Layout when the user selects the saver from
    the anim saver list on the Render panel.</p>
    <p><strong>Example</strong></p>
    <p>The SDK <a href="../../sample/avisave/">avisave</a> sample is an anim saver for Windows
    AVI files.</td>
  </tr>
</table>
</body>
</html>
